package main;

import filesystem.GlobalFSData;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import controller.MainController;
import javafx.stage.StageStyle;

import java.io.IOException;
import java.net.URL;

public class Main extends Application {

	public static final String DISK = "disk.dat";
	public static final int UP_PADDING = 0;
	public static final int RIGHT_PADDING = 0;
	public static final int DOWN_PADDING = 0;
	public static final int LEFT_PADDING = 0;
	public static final int PANEL_HEIGHT = 600;
	public static final int PANEL_WIDTH = 900;

	@Override
	public void start(Stage primaryStage) throws IOException {
		URL location = this.getClass().getResource("/view/MainWindow.fxml");
		if(location==null){
			System.out.println("null");
		}
		else{
			FXMLLoader fxmlLoader = new FXMLLoader();
			fxmlLoader.setLocation(location);
			Parent root= (Parent) fxmlLoader.load();
			primaryStage.setTitle("System2022");

			Scene scene=new Scene(root);
			//此处可以写个自适应屏幕
			final MainController mainWindowController=(MainController)fxmlLoader.getController();
			primaryStage.setScene(scene);
			primaryStage.show();
			mainWindowController.init(scene,primaryStage);
		}
	}

	public static void main(String[] args) {
		GlobalFSData.init();
		launch(args);
	}
}
